﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaintanceAccountAppUsers.aspx.cs"
    Inherits="Zyg.SSO.Web.MaintanceAccountAppUsers" %>

<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>应用系统用户修改-SSO后台管理系统</title>
    <style type="text/css">
        fieldset
        {
            padding: 10px;
        }
    </style>
</head>
<body class="dbody">
    <form id="form1" runat="server">
    <div class="clearfix">
        <div id="addid" style="float: left; width: 250px;">
            <fieldset>
                <legend>添加新映射</legend>
                <table cellpadding="5" cellspacing="0" border="0">
                    <tr>
                        <td>
                            用户名:
                        </td>
                        <td>
                            <asp:TextBox ID="NewName" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            密&nbsp;&nbsp;码:
                        </td>
                        <td>
                            <asp:TextBox ID="NewPass" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="BtnAdd" runat="server" Text="添  加" OnClick="BtnAdd_OnClick" CssClass="button" />
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
        <div id="modifyid" style="float: left; width: 250px; margin-left: 10px;">
            <fieldset>
                <legend>修改映射</legend>
                <table cellpadding="5" cellspacing="0" border="0">
                    <tr>
                        <td>
                            用户名:
                        </td>
                        <td id="ModifyName">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            新密码:
                        </td>
                        <td>
                            <asp:TextBox ID="ModifyPass" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="BtnModify" runat="server" Text="修  改" OnClick="BtnModify_OnClick"
                                CssClass="button" />
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
    </div>
    <br />
    <br />
    <fieldset>
        <legend>现有映射</legend>
        <p>
            <asp:Button ID="BtnDelete" runat="server" Text="删除" CssClass="button" OnClick="BtnDelete_Click" />
        </p>
        <asp:GridView ID="AccountAppUserGridView" DataKeyNames="ID" runat="server" BorderWidth="0"
            CellPadding="0" CellSpacing="0" CssClass="infoTable" AutoGenerateColumns="false">
            <Columns>
                <asp:TemplateField ControlStyle-CssClass="center" ItemStyle-CssClass="center">
                    <HeaderTemplate>
                        <asp:CheckBox ID="SelectAllCB" runat="server" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="SelectCB" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Id" ShowHeader="false" ControlStyle-CssClass="hide" ItemStyle-CssClass="hide"
                    HeaderStyle-CssClass="hide" />
                <asp:BoundField DataField="Name" HeaderText="用户名" />
                <asp:BoundField DataField="Password" HeaderText="密码" />
                <asp:BoundField DataField="DateCreated" HeaderText="创建日期" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" NavigateUrl="javascript:;" runat="server">修改</asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                暂无映射数据
            </EmptyDataTemplate>
        </asp:GridView>
    </fieldset>
    <asp:HiddenField ID="APIDHF" runat="server" />
    <asp:HiddenField ID="AccountIDHF" runat="server" />
    <asp:HiddenField ID="AccountAppUserIDHF" runat="server" />
    </form>

    <script type="text/javascript" src="/script/jquery/jquery-1.2.6.min.js" charset="utf-8"></script>

    <script type="text/javascript" src="/script/zyg.sso.js" charset="utf-8"></script>

    <script type="text/javascript">
        $("#BtnDelete").attr("disabled", "disabled");
        zyg.sso.infoTable({
            id: '#AccountAppUserGridView',
            checkAll: true,
            checkChangedCallback: function() {
                var a = arguments[0];
                if (a.checkedCount == 0) {
                    $("#BtnDelete").attr("disabled", "disabled");
                } else {
                    $("#BtnDelete").attr("disabled", "");
                }
            }
        });
        $("#AccountAppUserGridView").find("a").click(function() {
            var name = $(this).parent().parent().find(":nth-child(3)").html();
            var pwd = $(this).parent().parent().find(":nth-child(4)").html();
            var id = $(this).parent().parent().find(":nth-child(2)").html();
            $("#ModifyName").html(name);
            $("#ModifyPass").val(pwd);
            $("#AccountAppUserIDHF").val(id);
        });
        $("#BtnAdd").click(function(e) {
            if ($.trim($("#NewName").val()).length == 0) {
                alert('用户名不能为空');
                e.preventDefault();
                return;
            }

            if ($.trim($("#NewPass").val()).length == 0) {
                alert('用户密码不能为空');
                e.preventDefault();
            }
        });
        $("#BtnModify").click(function(e) {
            if ($.trim($("#ModifyPass").val()).length == 0) {
                alert('密码不能为空');
                e.preventDefault();
            }
        });
    </script>

</body>
</html>
